home *** CD-ROM | disk | FTP | other *** search
-
- Hello there!
-
- Vulture here... Just for convinience, I've stated the primairy formulas and
- definitions in a seperate file. I had a hard time understanding this math
- and writing these things down proved to be quite helpfull.
-
- ──────────────────────────────────────────────────────────────────────────────
-
- Vector definitions:
-
- V1 = P2 - P1 (x2-x1,y2-y1,z2-z1)
- V2 = P3 - P1 (x3-x1,y3-y1,z3-z1)
-
- Crossproduct:
-
- V3 = V1 * V2 = (y1*z2-y2*z1, z1*x2-z2*x1, x1*y2-x2*y1)
-
- Set length vector to 1:
-
- V3 = V3 / sqrt(x*x+y*y+z*z)
-
- Dotproduct:
-
- D = V1 * V2 = (x1*x2)+(y1*y2)+(z1*z2)
-
- Lightvector (defined by you):
-
- L = (0,0,-1)
-
- ──────────────────────────────────────────────────────────────────────────────
-
- First we define some vectors to do our calculations with. Secondly we
- take the crossproduct of those vectors which returns a vector which is
- at 90 degrees to the poly. The lenght of the vector must then be set to 1.
-
- Also, a socalled lightvector is defined. If the light is coming from
- behind us, this vector would be like stated above.
-
- To find the color of the polygon we take the dotproduct of the normal
- we just calculated and the lightvector. Goodluck!
-
- -Vulture/OT-
-